 
 import HTTP from '@/utils/config.js';
/**
 * @param {String}  
 */
const token1 = uni.getStorageSync('token');

export const uploadImage = async (url) => {
	return new Promise((resolve, reject) => {
		console.log(url)
		uni.getFileInfo({
			filePath:url,
			success:imginfo=>{
				console.log(imginfo.size)
				if(imginfo.size<1024*1024){
					let a = uni.uploadFile({
						url: HTTP.HTTP+ '/api/common/upload', 
						filePath: url,
						name: 'file',
						formData: {
							token: token1
						},
						success: (res) => {
							resolve(res.data)
						},
						fail:(res)=> {
							reject(res.data)
						}
					});
				}
				
			}
		})
		
	})
	
	 

};

 
 